home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13644 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.4 KB

  1. Path: gaia.ns.utk.edu!mbk
  2. From: mbk@caffeine.engr.utk.edu (Matt Kennel)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Will JAVA kill C++?
  5. Date: 26 Mar 1996 21:00:28 GMT
  6. Organization: University of Tennessee, Knoxville and Oak Ridge National Laboratory
  7. Message-ID: <4j9ltc$h2n@gaia.ns.utk.edu>
  8. References: <313E44EA.14D110C0@netcom.com> <4hp18v$3di@frodo.smartlink.net> <4ht8k1$t7l@epx.cis.umn.edu> <3146278D.7703E9CC@netcom.com> <4i6q13$4e8@gaia.ns.utk.edu> <4j9gf5$e01@druid.borland.com>
  9. Reply-To: kennel@msr.epm.ornl.gov
  10. NNTP-Posting-Host: caffeine.engr.utk.edu
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13. Pete Becker (pete@borland.com) wrote:
  14. : In article <4i6q13$4e8@gaia.ns.utk.edu>, mbk@caffeine.engr.utk.edu says...
  15. : >
  16. : >Adam Megacz (kalessin@netcom.com) wrote:
  17. : >: Olivier Meirhaeghe wrote:
  18. : >
  19. : >: > whoever wants speed should stick to C or Fortran, not C++. Heavy graphics
  20. : >: I'm not a Fortran buff, but I don't understand why C is faster than C++.
  21. : >: C++ supports all C features (except the void* crap). If anything, C++'s
  22. : >: type-checking allows more compiler optimizations, making it a slightly
  23. : >: faster language.
  24. : >
  25. : >C is not faster than C++ if you use C++ as plain C compiler.
  26. : >
  27. : >If you want to use features of C++ that theoretically ought to seem
  28. : >good for numerical programming, such as complex number classes and 
  29. : >especially matrix classes, various language consequences of C++ combine
  30. : >to make things slower than they should be with nearly all compilers if you
  31. : >want to use idiomatic matrix classes. 
  32.  
  33. :     It turns out that this isn't necessarily true. There was a paper 
  34. : presented by David Vandevoorde at the latest ANSI/ISO C++ meeting about 
  35. : implementing the valarray template in a way that permitted aggressive 
  36. : optimizations. With his changes, expressions like sum(1.2*x-2.3*y+3.4); can be 
  37. : compiled into code that runs just as fast as the corresponding C code with 
  38. : explicit loops, plus a bit of setup time. That's with straight gcc, not a 
  39. : compiler that's specifically optimized for valarray.
  40. :     Basically, the technique is to implement valarray in such a way that 
  41. : arithmetic operations on valarrays build a parse tree rather than performing 
  42. : the actual operation.
  43.  
  44. That is an interesting virtuoso solution for some problems.
  45.  
  46. But it wouldn't help somebody programming say inner loops of the singular
  47. value decomposition or other algorithms whose operations were not
  48. simple algebraic functions of other matrices. 
  49.  
  50. :     -- Pete
  51.  
  52.